#pragma once
#include <QObject>
#include <QMutex>
#include "FileTransfer.h"

class FileTransferManager : public QObject
{
    Q_OBJECT
protected:
    explicit FileTransferManager(QObject* parent = nullptr);
    ~FileTransferManager();

public:
    static FileTransferManager* getInstance();

public:
    FileTransfer* addFileTransfer(const QString& name, int port);
    void removeFileTransfer(const QString& name);
    FileTransfer* getFileTransfer(const QString& name) const;
    QList<FileTransfer*> getFileTransferList() const;
    QMap<QString, FileTransfer*>::const_iterator getFileTransferMapIter() const;

private:
    QMap<QString, FileTransfer*> mFileTransferMap;

    static QMutex mMutex;
    static FileTransferManager* mInstance;
};

FileTransferManager* getFileTransferManager();